home *** CD-ROM | disk | FTP | other *** search
/ DarkBASIC - The Ultimate 3D Game Creator / PCactive 8 CD1 - DarkBasic.iso / SOFTWARE / DEMOS / DarkForge2000 / snippets_vol4 / snip_rastercarpet.dba < prev    next >
Encoding:
Text File  |  2000-10-13  |  1.6 KB  |  96 lines

  1. `    ------------------------------------------------------------------------
  2. `    Raster Carpet                              DarkForge Snippet (6/10/2000)
  3. `    ------------------------------------------------------------------------
  4. `    30 Vertical "rasters" sine-waving against a starfield and logo.
  5. `    Uses a BMP for the rasters because I'm too lazy to generate with code :)
  6.  
  7. hide mouse
  8. sync rate 0
  9. sync on
  10.  
  11. load image "bars2a.bmp",100
  12.  
  13. for a=0 to 480
  14.     paste image 100,0,a
  15. next a
  16.  
  17. for a=0 to 29
  18.  
  19. `    this version does a pointed wave
  20.     get image 1+a,a*16,a*2,(16*a)+16,480-(a*2)
  21.  
  22. `    this version is full height, but missing the tops
  23. `    get image 1+a,a*16,a*2,(16*a)+16,480
  24.  
  25. next a
  26.  
  27. `    Play with the speed value for some cool stuff :)
  28.  
  29. step=3 : sx=0 : speed=3
  30.  
  31. `    Make our little star graphic
  32.  
  33. ink rgb(0,255,255),0 : dot 1,1
  34. ink rgb(100,50,155),0 : dot 1,0 : dot 1,2 : dot 0,1 : dot 2,1
  35. get image 100,0,0,3,3
  36.  
  37. cls 0
  38.  
  39. `    Draw a little logo
  40.  
  41. set text font "Terminal"
  42. set text size 12
  43. i=6
  44. for a=50 to 255 step 50
  45.     ink rgb(a,a,a),0
  46.     text i,0,"DarkForge.co.uk"
  47.     dec i
  48. next a
  49. get image 101,0,0,125,16
  50.  
  51. `    Starfield code
  52.  
  53. n=75
  54. dim x(n,3)
  55.  
  56. for i=1 to n
  57.     x(i,1)=rnd(639)+1
  58.     x(i,2)=rnd(479)+ 1
  59.     x(i,3)=rnd(9)+1
  60. next i
  61.  
  62. `    The main loop
  63.  
  64. create bitmap 1,640,480
  65.  
  66. do
  67.  
  68.     cls 0
  69.  
  70.     paste image 101,0,0
  71.  
  72.     for i=1 to n
  73.  
  74.         x(i,1)=x(i,1)-x(i,3)
  75.         
  76.         if x(i,1)<=1
  77.             x(i,1)=640
  78.             x(i,2)=rnd(479)+1
  79.         endif
  80.     
  81.         paste image 100,x(i,1),x(i,2)
  82.     
  83.     next i
  84.  
  85.     for a=1 to 30
  86.         paste image a,290+sin(sx+(a*step*2))*150,a*2
  87.     next a
  88.  
  89.     inc sx,speed
  90.  
  91.     copy bitmap 1,0
  92.     sync
  93.  
  94. loop
  95.  
  96.